Rails.application.routes.draw do
  get 'rooms/index'
  get 'welcome/index'
  # get '/users/:id', to: 'users#show'
  get 'home/user', to: 'home#user', as: :home_user

  devise_for :users, controllers: {
    # sessions: 'users/sessions',
    registrations: 'users/registrations'
  }
  devise_scope :user do
    # get 'users/sign_in', to: 'users/sessions#new'
    # get 'sign_up', to: 'users/registrations#new'
    get 'users/sign_out', to: 'devise/sessions#destroy'
    # get 'forgot_password', to: 'users/passwords#new'
    # get 'reset_password', to: 'users/passwords#edit'
  end
  # resources :users, only: [:show]
  resources :rooms
  resources :rooms do
    resources :messages
  end
  resources :users do
    resources :goods
    collection do
      get :list
    end
    member do
      get :history
    end
  end

  resources :goods do
    resources :comments
    collection do
      get :find
      get :list
      get :search
      get :publish
    end
    member do
      get :show
      get :order
      post :edit
    end
  end

  # resources :users do 
  #   member do
  #     get :home
  #   end
  # end

  # Defines the root path route ("/")
  root to: 'welcome#index'
  # root "goods#list"
end
